<!-- HTML header for doxygen 1.9.6-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.6"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>COMMONS-NET: commonsNet.time.TimeUDPClient类 参考</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
  $(document).ready(function() { init_search(); });
/* @license-end */
</script>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname">COMMONS-NET
   </div>
  </td>
    <td>        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <span id="MSearchSelect"                onmouseover="return searchBox.OnSearchSelectShow()"                onmouseout="return searchBox.OnSearchSelectHide()">&#160;</span>
          <input type="text" id="MSearchField" value="" placeholder="搜索" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.svg" alt=""/></a>
          </span>
        </div>
</td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.9.6 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('classcommonsNet_1_1time_1_1TimeUDPClient.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">载入中...</div>
<div class="SRStatus" id="Searching">搜索中...</div>
<div class="SRStatus" id="NoMatches">未找到</div>
</div>
</div>
</div>
</div>

<div class="header">
  <div class="summary">
<a href="#pub-methods">Public 成员函数</a> &#124;
<a href="#pub-attribs">Public 属性</a> &#124;
<a href="#pri-attribs">Private 属性</a> &#124;
<a href="classcommonsNet_1_1time_1_1TimeUDPClient-members.html">所有成员列表</a>  </div>
  <div class="headertitle"><div class="title">commonsNet.time.TimeUDPClient类 参考</div></div>
</div><!--header-->
<div class="contents">

<p>TimeUDPClient 类是一个实现了 RFC 868 时间协议的 UDP 客户端。  
 <a href="classcommonsNet_1_1time_1_1TimeUDPClient.html#details">更多...</a></p>
<div class="dynheader">
类 commonsNet.time.TimeUDPClient 继承关系图:</div>
<div class="dyncontent">
 <div class="center">
  <img src="classcommonsNet_1_1time_1_1TimeUDPClient.png" usemap="#commonsNet.time.TimeUDPClient_map" alt=""/>
  <map id="commonsNet.time.TimeUDPClient_map" name="commonsNet.time.TimeUDPClient_map">
<area href="classcommonsNet_1_1DatagramSocketClient.html" alt="commonsNet.DatagramSocketClient" shape="rect" coords="0,0,211,24"/>
  </map>
</div></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-methods" name="pub-methods"></a>
Public 成员函数</h2></td></tr>
<tr class="memitem:a98f43589688708c1694e0562a2a18c9f"><td class="memItemLeft" align="right" valign="top">public func&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcommonsNet_1_1time_1_1TimeUDPClient.html#a98f43589688708c1694e0562a2a18c9f">getDateTime</a> (host: String): DateTime</td></tr>
<tr class="memdesc:a98f43589688708c1694e0562a2a18c9f"><td class="mdescLeft">&#160;</td><td class="mdescRight">与 getDateTime(host, DEFAULT_PORT) 等效。  <br /></td></tr>
<tr class="separator:a98f43589688708c1694e0562a2a18c9f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a06d22aa75dae4026e62a4482faf6b8e4"><td class="memItemLeft" align="right" valign="top">public func&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcommonsNet_1_1time_1_1TimeUDPClient.html#a06d22aa75dae4026e62a4482faf6b8e4">getDateTime</a> (host: String, port: UInt16): DateTime</td></tr>
<tr class="memdesc:a06d22aa75dae4026e62a4482faf6b8e4"><td class="mdescLeft">&#160;</td><td class="mdescRight">从指定的服务器和端口获取时间，并返回转换为本地时区的 DateTime 对象。  <br /></td></tr>
<tr class="separator:a06d22aa75dae4026e62a4482faf6b8e4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a181912785f6126b63f729718dd957082"><td class="memItemLeft" align="right" valign="top">public func&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcommonsNet_1_1time_1_1TimeUDPClient.html#a181912785f6126b63f729718dd957082">getTime</a> (host: String): UInt64</td></tr>
<tr class="memdesc:a181912785f6126b63f729718dd957082"><td class="mdescLeft">&#160;</td><td class="mdescRight">与 getTime(host, DEFAULT_PORT) 等效。  <br /></td></tr>
<tr class="separator:a181912785f6126b63f729718dd957082"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac9a0467674e2ed10203c56797d389604"><td class="memItemLeft" align="right" valign="top">public func&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcommonsNet_1_1time_1_1TimeUDPClient.html#ac9a0467674e2ed10203c56797d389604">getTime</a> (host: String, port: UInt16): UInt64</td></tr>
<tr class="memdesc:ac9a0467674e2ed10203c56797d389604"><td class="mdescLeft">&#160;</td><td class="mdescRight">从指定的服务器和端口获取时间。时间是自1900年1月1日00:00:00 GMT起的秒数，符合 RFC 868 的要求。  <br /></td></tr>
<tr class="separator:ac9a0467674e2ed10203c56797d389604"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="inherit_header pub_methods_classcommonsNet_1_1DatagramSocketClient"><td colspan="2" onclick="javascript:toggleInherit('pub_methods_classcommonsNet_1_1DatagramSocketClient')"><img src="closed.png" alt="-"/>&#160;Public 成员函数 继承自 <a class="el" href="classcommonsNet_1_1DatagramSocketClient.html">commonsNet.DatagramSocketClient</a></td></tr>
<tr class="memitem:a9bebd92e7988ee9c12dbcf538f236868 inherit pub_methods_classcommonsNet_1_1DatagramSocketClient"><td class="memItemLeft" align="right" valign="top">public&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcommonsNet_1_1DatagramSocketClient.html#a9bebd92e7988ee9c12dbcf538f236868">init</a> ()</td></tr>
<tr class="memdesc:a9bebd92e7988ee9c12dbcf538f236868 inherit pub_methods_classcommonsNet_1_1DatagramSocketClient"><td class="mdescLeft">&#160;</td><td class="mdescRight">无参构造函数 <em>socket</em>=None; <em>timeout</em>=0; <em>isOpen</em>=false; <em>socketFactory</em>= DEFAULT_SOCKET_FACTORY;  <br /></td></tr>
<tr class="separator:a9bebd92e7988ee9c12dbcf538f236868 inherit pub_methods_classcommonsNet_1_1DatagramSocketClient"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0a94deac969cd5a4cea9634d9195d658 inherit pub_methods_classcommonsNet_1_1DatagramSocketClient"><td class="memItemLeft" align="right" valign="top">public mut prop&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcommonsNet_1_1DatagramSocketClient.html#a0a94deac969cd5a4cea9634d9195d658">receiveTimeout</a> : ?Duration</td></tr>
<tr class="memdesc:a0a94deac969cd5a4cea9634d9195d658 inherit pub_methods_classcommonsNet_1_1DatagramSocketClient"><td class="mdescLeft">&#160;</td><td class="mdescRight">属性readTimeout，用于设置和获取readTimeout  <br /></td></tr>
<tr class="separator:a0a94deac969cd5a4cea9634d9195d658 inherit pub_methods_classcommonsNet_1_1DatagramSocketClient"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac91a43c12fc616a881e49a3764364f2d inherit pub_methods_classcommonsNet_1_1DatagramSocketClient"><td class="memItemLeft" align="right" valign="top">public mut prop&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcommonsNet_1_1DatagramSocketClient.html#ac91a43c12fc616a881e49a3764364f2d">sendTimeout</a> : ?Duration</td></tr>
<tr class="memdesc:ac91a43c12fc616a881e49a3764364f2d inherit pub_methods_classcommonsNet_1_1DatagramSocketClient"><td class="mdescLeft">&#160;</td><td class="mdescRight">属性sendTimeout，用于设置和获取sendTimeout  <br /></td></tr>
<tr class="separator:ac91a43c12fc616a881e49a3764364f2d inherit pub_methods_classcommonsNet_1_1DatagramSocketClient"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a95f9d80f21489bb3eb1c251d30b8aeaf inherit pub_methods_classcommonsNet_1_1DatagramSocketClient"><td class="memItemLeft" align="right" valign="top">public func&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcommonsNet_1_1DatagramSocketClient.html#a95f9d80f21489bb3eb1c251d30b8aeaf">close</a> ()</td></tr>
<tr class="memdesc:a95f9d80f21489bb3eb1c251d30b8aeaf inherit pub_methods_classcommonsNet_1_1DatagramSocketClient"><td class="mdescLeft">&#160;</td><td class="mdescRight">用于关闭套接字  <br /></td></tr>
<tr class="separator:a95f9d80f21489bb3eb1c251d30b8aeaf inherit pub_methods_classcommonsNet_1_1DatagramSocketClient"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8568072f87aa0cc170d01eeea0d4274b inherit pub_methods_classcommonsNet_1_1DatagramSocketClient"><td class="memItemLeft" align="right" valign="top">public func&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcommonsNet_1_1DatagramSocketClient.html#a8568072f87aa0cc170d01eeea0d4274b">getDefaultTimeout</a> (): Int64</td></tr>
<tr class="memdesc:a8568072f87aa0cc170d01eeea0d4274b inherit pub_methods_classcommonsNet_1_1DatagramSocketClient"><td class="mdescLeft">&#160;</td><td class="mdescRight">获取打开套接字时使用的默认超时（以毫秒为单位）  <br /></td></tr>
<tr class="separator:a8568072f87aa0cc170d01eeea0d4274b inherit pub_methods_classcommonsNet_1_1DatagramSocketClient"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aafdf43214202f97695ffe50f8e77c3f6 inherit pub_methods_classcommonsNet_1_1DatagramSocketClient"><td class="memItemLeft" align="right" valign="top">public func&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcommonsNet_1_1DatagramSocketClient.html#aafdf43214202f97695ffe50f8e77c3f6">getLocalAddress</a> (): Array&lt;UInt8&gt;</td></tr>
<tr class="memdesc:aafdf43214202f97695ffe50f8e77c3f6 inherit pub_methods_classcommonsNet_1_1DatagramSocketClient"><td class="mdescLeft">&#160;</td><td class="mdescRight">获取客户端的套接字绑定到的本地地址。  <br /></td></tr>
<tr class="separator:aafdf43214202f97695ffe50f8e77c3f6 inherit pub_methods_classcommonsNet_1_1DatagramSocketClient"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aec74781fb202de91341c1151836dce88 inherit pub_methods_classcommonsNet_1_1DatagramSocketClient"><td class="memItemLeft" align="right" valign="top">public func&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcommonsNet_1_1DatagramSocketClient.html#aec74781fb202de91341c1151836dce88">getLocalPort</a> (): UInt16</td></tr>
<tr class="memdesc:aec74781fb202de91341c1151836dce88 inherit pub_methods_classcommonsNet_1_1DatagramSocketClient"><td class="mdescLeft">&#160;</td><td class="mdescRight">获取本地主机上打开的用于连接的套接字的端口号。  <br /></td></tr>
<tr class="separator:aec74781fb202de91341c1151836dce88 inherit pub_methods_classcommonsNet_1_1DatagramSocketClient"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a537cb7e36f353ef171bc5477cf12d14c inherit pub_methods_classcommonsNet_1_1DatagramSocketClient"><td class="memItemLeft" align="right" valign="top">public func&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcommonsNet_1_1DatagramSocketClient.html#a537cb7e36f353ef171bc5477cf12d14c">isOpen</a> (): Bool</td></tr>
<tr class="memdesc:a537cb7e36f353ef171bc5477cf12d14c inherit pub_methods_classcommonsNet_1_1DatagramSocketClient"><td class="mdescLeft">&#160;</td><td class="mdescRight">如果客户端具有当前打开的套接字，则为 true。  <br /></td></tr>
<tr class="separator:a537cb7e36f353ef171bc5477cf12d14c inherit pub_methods_classcommonsNet_1_1DatagramSocketClient"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac49b33247f17bf47dd062d1e68d7cb24 inherit pub_methods_classcommonsNet_1_1DatagramSocketClient"><td class="memItemLeft" align="right" valign="top">public func&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcommonsNet_1_1DatagramSocketClient.html#ac49b33247f17bf47dd062d1e68d7cb24">open</a> ()</td></tr>
<tr class="memdesc:ac49b33247f17bf47dd062d1e68d7cb24 inherit pub_methods_classcommonsNet_1_1DatagramSocketClient"><td class="mdescLeft">&#160;</td><td class="mdescRight">在本地主机上的第一个可用端口处打开 DatagramSocket。  <br /></td></tr>
<tr class="separator:ac49b33247f17bf47dd062d1e68d7cb24 inherit pub_methods_classcommonsNet_1_1DatagramSocketClient"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acfe0264b2b558712ef0605bbe6e6d805 inherit pub_methods_classcommonsNet_1_1DatagramSocketClient"><td class="memItemLeft" align="right" valign="top">public func&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcommonsNet_1_1DatagramSocketClient.html#acfe0264b2b558712ef0605bbe6e6d805">open</a> (port: UInt16)</td></tr>
<tr class="memdesc:acfe0264b2b558712ef0605bbe6e6d805 inherit pub_methods_classcommonsNet_1_1DatagramSocketClient"><td class="mdescLeft">&#160;</td><td class="mdescRight">在本地主机上的指定端口处打开 DatagramSocket  <br /></td></tr>
<tr class="separator:acfe0264b2b558712ef0605bbe6e6d805 inherit pub_methods_classcommonsNet_1_1DatagramSocketClient"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:afc3da28ec94b12365a60e0a8e0273409 inherit pub_methods_classcommonsNet_1_1DatagramSocketClient"><td class="memItemLeft" align="right" valign="top">public func&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcommonsNet_1_1DatagramSocketClient.html#afc3da28ec94b12365a60e0a8e0273409">open</a> (IPSocketAddress: IPSocketAddress)</td></tr>
<tr class="memdesc:afc3da28ec94b12365a60e0a8e0273409 inherit pub_methods_classcommonsNet_1_1DatagramSocketClient"><td class="mdescLeft">&#160;</td><td class="mdescRight">在指定端口的本地主机上的指定地址处打开 DatagramSocket  <br /></td></tr>
<tr class="separator:afc3da28ec94b12365a60e0a8e0273409 inherit pub_methods_classcommonsNet_1_1DatagramSocketClient"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a07f62c0c51a3d53142f08bc13d447ca0 inherit pub_methods_classcommonsNet_1_1DatagramSocketClient"><td class="memItemLeft" align="right" valign="top">public func&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcommonsNet_1_1DatagramSocketClient.html#a07f62c0c51a3d53142f08bc13d447ca0">setDatagramSocketFactory</a> (factory: ?<a class="el" href="interfacecommonsNet_1_1DatagramSocketFactory.html">DatagramSocketFactory</a>)</td></tr>
<tr class="memdesc:a07f62c0c51a3d53142f08bc13d447ca0 inherit pub_methods_classcommonsNet_1_1DatagramSocketClient"><td class="mdescLeft">&#160;</td><td class="mdescRight">设置DatagramSocketClient使用的DatagramSocketFactory来打开DatagramSockets  <br /></td></tr>
<tr class="separator:a07f62c0c51a3d53142f08bc13d447ca0 inherit pub_methods_classcommonsNet_1_1DatagramSocketClient"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2986e7ad450928ce89e35b38ec539fd8 inherit pub_methods_classcommonsNet_1_1DatagramSocketClient"><td class="memItemLeft" align="right" valign="top">public func&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcommonsNet_1_1DatagramSocketClient.html#a2986e7ad450928ce89e35b38ec539fd8">setDefaultTimeout</a> (timeout: Duration)</td></tr>
<tr class="memdesc:a2986e7ad450928ce89e35b38ec539fd8 inherit pub_methods_classcommonsNet_1_1DatagramSocketClient"><td class="mdescLeft">&#160;</td><td class="mdescRight">设置打开套接字时使用的默认超时  <br /></td></tr>
<tr class="separator:a2986e7ad450928ce89e35b38ec539fd8 inherit pub_methods_classcommonsNet_1_1DatagramSocketClient"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa7c800ada59a901f353dab58758525d6 inherit pub_methods_classcommonsNet_1_1DatagramSocketClient"><td class="memItemLeft" align="right" valign="top">public func&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcommonsNet_1_1DatagramSocketClient.html#aa7c800ada59a901f353dab58758525d6">setDefaultTimeout</a> (timeout: Int64)</td></tr>
<tr class="memdesc:aa7c800ada59a901f353dab58758525d6 inherit pub_methods_classcommonsNet_1_1DatagramSocketClient"><td class="mdescLeft">&#160;</td><td class="mdescRight">设置打开套接字时使用的默认超时  <br /></td></tr>
<tr class="separator:aa7c800ada59a901f353dab58758525d6 inherit pub_methods_classcommonsNet_1_1DatagramSocketClient"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-attribs" name="pub-attribs"></a>
Public 属性</h2></td></tr>
<tr class="memitem:ad855cbc961ed63847a19bc1cc97f9562"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcommonsNet_1_1time_1_1TimeUDPClient.html#ad855cbc961ed63847a19bc1cc97f9562">static var DEFAULT_PORT</a> : UInt16 = 37</td></tr>
<tr class="memdesc:ad855cbc961ed63847a19bc1cc97f9562"><td class="mdescLeft">&#160;</td><td class="mdescRight">默认时间端口，按照 RFC 868 规定将端口设置为 37。  <br /></td></tr>
<tr class="separator:ad855cbc961ed63847a19bc1cc97f9562"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8100daa6a0375055e29bd421925de692"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcommonsNet_1_1time_1_1TimeUDPClient.html#a8100daa6a0375055e29bd421925de692">static let SECONDS_1900_TO_1970</a> : UInt64 = 2208988800</td></tr>
<tr class="memdesc:a8100daa6a0375055e29bd421925de692"><td class="mdescLeft">&#160;</td><td class="mdescRight">1900年1月1日00:00到1970年1月31日00:00之间的秒数  <br /></td></tr>
<tr class="separator:a8100daa6a0375055e29bd421925de692"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pri-attribs" name="pri-attribs"></a>
Private 属性</h2></td></tr>
<tr class="memitem:ac1c23d4e00ebbee652ea42631bfecb24"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcommonsNet_1_1time_1_1TimeUDPClient.html#ac1c23d4e00ebbee652ea42631bfecb24">let dummyData</a> = Array&lt;Byte&gt;(1, repeat: 0)</td></tr>
<tr class="memdesc:ac1c23d4e00ebbee652ea42631bfecb24"><td class="mdescLeft">&#160;</td><td class="mdescRight">用于发送的虚拟数据包。  <br /></td></tr>
<tr class="separator:ac1c23d4e00ebbee652ea42631bfecb24"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a25ce250f7e6c66e732a2e3772a7f6c74"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcommonsNet_1_1time_1_1TimeUDPClient.html#a25ce250f7e6c66e732a2e3772a7f6c74">let timeData</a> = Array&lt;Byte&gt;(4, repeat: 0)</td></tr>
<tr class="memdesc:a25ce250f7e6c66e732a2e3772a7f6c74"><td class="mdescLeft">&#160;</td><td class="mdescRight">用于接收时间数据的字节数组。  <br /></td></tr>
<tr class="separator:a25ce250f7e6c66e732a2e3772a7f6c74"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="inherited" name="inherited"></a>
额外继承的成员函数</h2></td></tr>
<tr class="inherit_header pro_methods_classcommonsNet_1_1DatagramSocketClient"><td colspan="2" onclick="javascript:toggleInherit('pro_methods_classcommonsNet_1_1DatagramSocketClient')"><img src="closed.png" alt="-"/>&#160;Protected 成员函数 继承自 <a class="el" href="classcommonsNet_1_1DatagramSocketClient.html">commonsNet.DatagramSocketClient</a></td></tr>
<tr class="memitem:a7060e4aa1d53b57b837bfc280eaa9daf inherit pro_methods_classcommonsNet_1_1DatagramSocketClient"><td class="memItemLeft" align="right" valign="top">protected func&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcommonsNet_1_1DatagramSocketClient.html#a7060e4aa1d53b57b837bfc280eaa9daf">checkOpen</a> (): UdpSocket</td></tr>
<tr class="memdesc:a7060e4aa1d53b57b837bfc280eaa9daf inherit pro_methods_classcommonsNet_1_1DatagramSocketClient"><td class="mdescLeft">&#160;</td><td class="mdescRight">得到非空的UdpSocket或者抛出异常  <br /></td></tr>
<tr class="separator:a7060e4aa1d53b57b837bfc280eaa9daf inherit pro_methods_classcommonsNet_1_1DatagramSocketClient"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="inherit_header pro_attribs_classcommonsNet_1_1DatagramSocketClient"><td colspan="2" onclick="javascript:toggleInherit('pro_attribs_classcommonsNet_1_1DatagramSocketClient')"><img src="closed.png" alt="-"/>&#160;Protected 属性 继承自 <a class="el" href="classcommonsNet_1_1DatagramSocketClient.html">commonsNet.DatagramSocketClient</a></td></tr>
<tr class="memitem:ac1d6e58d6682ffe35a5d1ddd767f747b inherit pro_attribs_classcommonsNet_1_1DatagramSocketClient"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcommonsNet_1_1DatagramSocketClient.html#ac1d6e58d6682ffe35a5d1ddd767f747b">var _timeout_</a> : Int64</td></tr>
<tr class="memdesc:ac1d6e58d6682ffe35a5d1ddd767f747b inherit pro_attribs_classcommonsNet_1_1DatagramSocketClient"><td class="mdescLeft">&#160;</td><td class="mdescRight">默认超时  <br /></td></tr>
<tr class="separator:ac1d6e58d6682ffe35a5d1ddd767f747b inherit pro_attribs_classcommonsNet_1_1DatagramSocketClient"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae817188cccd266d039b791da4f839c4d inherit pro_attribs_classcommonsNet_1_1DatagramSocketClient"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcommonsNet_1_1DatagramSocketClient.html#ae817188cccd266d039b791da4f839c4d">var _socket_</a> : ?UdpSocket</td></tr>
<tr class="memdesc:ae817188cccd266d039b791da4f839c4d inherit pro_attribs_classcommonsNet_1_1DatagramSocketClient"><td class="mdescLeft">&#160;</td><td class="mdescRight">用于连接的数据报套接字  <br /></td></tr>
<tr class="separator:ae817188cccd266d039b791da4f839c4d inherit pro_attribs_classcommonsNet_1_1DatagramSocketClient"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a81cba3257050238fc73f20aadceb4d69 inherit pro_attribs_classcommonsNet_1_1DatagramSocketClient"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcommonsNet_1_1DatagramSocketClient.html#a81cba3257050238fc73f20aadceb4d69">var _isOpen_</a> : Bool</td></tr>
<tr class="memdesc:a81cba3257050238fc73f20aadceb4d69 inherit pro_attribs_classcommonsNet_1_1DatagramSocketClient"><td class="mdescLeft">&#160;</td><td class="mdescRight">客户端的套接字当前是否处于打开状态  <br /></td></tr>
<tr class="separator:a81cba3257050238fc73f20aadceb4d69 inherit pro_attribs_classcommonsNet_1_1DatagramSocketClient"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aae67ef3bfdd385af99f91c034e941bcc inherit pro_attribs_classcommonsNet_1_1DatagramSocketClient"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcommonsNet_1_1DatagramSocketClient.html#aae67ef3bfdd385af99f91c034e941bcc">var _socketFactory_</a> : <a class="el" href="interfacecommonsNet_1_1DatagramSocketFactory.html">DatagramSocketFactory</a></td></tr>
<tr class="memdesc:aae67ef3bfdd385af99f91c034e941bcc inherit pro_attribs_classcommonsNet_1_1DatagramSocketClient"><td class="mdescLeft">&#160;</td><td class="mdescRight">数据报套接字的 DatagramSocketFactory  <br /></td></tr>
<tr class="separator:aae67ef3bfdd385af99f91c034e941bcc inherit pro_attribs_classcommonsNet_1_1DatagramSocketClient"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">详细描述</h2>
<div class="textblock"><p>TimeUDPClient 类是一个实现了 RFC 868 时间协议的 UDP 客户端。 </p>
<p>使用该类，只需使用 open 方法打开一个本地数据报套接字，然后调用 <code><a class="el" href="">getTime()</a></code> 或 <code><a class="el" href="">getDateTime()</a></code> 方法来获取时间。随后，调用 close 方法来正确关闭连接。 与 TimeTCPClient 不同的是，UDP 是无连接的协议，而时间协议是无状态的，因此允许在不重新建立连接的情况下进行连续的 getTime 或 getDate getDate 调用。</p>
<dl class="section see"><dt>参见</dt><dd>TimeTCPClient </dd></dl>
</div><h2 class="groupheader">成员函数说明</h2>
<a id="a98f43589688708c1694e0562a2a18c9f" name="a98f43589688708c1694e0562a2a18c9f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a98f43589688708c1694e0562a2a18c9f">&#9670;&#160;</a></span>getDateTime() <span class="overload">[1/2]</span></h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">public func commonsNet.time.TimeUDPClient.getDateTime </td>
          <td>(</td>
          <td class="paramname"><em>host</em>:&#160;</td>
          <td class="paramtype">String</td><td>)</td>
          <td>: DateTime </td>
        </tr>
      </table>
</div><div class="memdoc">

<p>与 getDateTime(host, DEFAULT_PORT) 等效。 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">host</td><td>时间服务器的地址 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>包含从服务器获取的时间并转换为本地时区的 DateTime 对象 </dd></dl>

</div>
</div>
<a id="a06d22aa75dae4026e62a4482faf6b8e4" name="a06d22aa75dae4026e62a4482faf6b8e4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a06d22aa75dae4026e62a4482faf6b8e4">&#9670;&#160;</a></span>getDateTime() <span class="overload">[2/2]</span></h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">public func commonsNet.time.TimeUDPClient.getDateTime </td>
          <td>(</td>
          <td class="paramname"><em>host</em>:&#160;</td>
          <td class="paramtype">String, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramname"><em>port</em>:&#160;</td>
          <td class="paramtype">UInt16&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td>: DateTime </td>
        </tr>
      </table>
</div><div class="memdoc">

<p>从指定的服务器和端口获取时间，并返回转换为本地时区的 DateTime 对象。 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">host</td><td>服务器的地址 </td></tr>
    <tr><td class="paramname">port</td><td>服务的端口 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>包含从服务器获取的时间并转换为本地时区的 DateTime 对象 </dd></dl>

</div>
</div>
<a id="a181912785f6126b63f729718dd957082" name="a181912785f6126b63f729718dd957082"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a181912785f6126b63f729718dd957082">&#9670;&#160;</a></span>getTime() <span class="overload">[1/2]</span></h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">public func commonsNet.time.TimeUDPClient.getTime </td>
          <td>(</td>
          <td class="paramname"><em>host</em>:&#160;</td>
          <td class="paramtype">String</td><td>)</td>
          <td>: UInt64 </td>
        </tr>
      </table>
</div><div class="memdoc">

<p>与 getTime(host, DEFAULT_PORT) 等效。 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">host</td><td>时间服务器的地址 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>从服务器返回的时间（秒数） </dd></dl>

</div>
</div>
<a id="ac9a0467674e2ed10203c56797d389604" name="ac9a0467674e2ed10203c56797d389604"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac9a0467674e2ed10203c56797d389604">&#9670;&#160;</a></span>getTime() <span class="overload">[2/2]</span></h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">public func commonsNet.time.TimeUDPClient.getTime </td>
          <td>(</td>
          <td class="paramname"><em>host</em>:&#160;</td>
          <td class="paramtype">String, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramname"><em>port</em>:&#160;</td>
          <td class="paramtype">UInt16&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td>: UInt64 </td>
        </tr>
      </table>
</div><div class="memdoc">

<p>从指定的服务器和端口获取时间。时间是自1900年1月1日00:00:00 GMT起的秒数，符合 RFC 868 的要求。 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">host</td><td>服务器的地址 </td></tr>
    <tr><td class="paramname">port</td><td>服务的端口 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>从服务器获取的时间值（秒数） </dd></dl>

</div>
</div>
<h2 class="groupheader">类成员变量说明</h2>
<a id="ac1c23d4e00ebbee652ea42631bfecb24" name="ac1c23d4e00ebbee652ea42631bfecb24"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac1c23d4e00ebbee652ea42631bfecb24">&#9670;&#160;</a></span>let dummyData</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">commonsNet.time.TimeUDPClient.let dummyData = Array&lt;Byte&gt;(1, repeat: 0)</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">private</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>用于发送的虚拟数据包。 </p>

</div>
</div>
<a id="a25ce250f7e6c66e732a2e3772a7f6c74" name="a25ce250f7e6c66e732a2e3772a7f6c74"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a25ce250f7e6c66e732a2e3772a7f6c74">&#9670;&#160;</a></span>let timeData</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">commonsNet.time.TimeUDPClient.let timeData = Array&lt;Byte&gt;(4, repeat: 0)</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">private</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>用于接收时间数据的字节数组。 </p>

</div>
</div>
<a id="a8100daa6a0375055e29bd421925de692" name="a8100daa6a0375055e29bd421925de692"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8100daa6a0375055e29bd421925de692">&#9670;&#160;</a></span>static let SECONDS_1900_TO_1970</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">commonsNet.time.TimeUDPClient.static let SECONDS_1900_TO_1970 : UInt64 = 2208988800</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>1900年1月1日00:00到1970年1月31日00:00之间的秒数 </p>

</div>
</div>
<a id="ad855cbc961ed63847a19bc1cc97f9562" name="ad855cbc961ed63847a19bc1cc97f9562"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad855cbc961ed63847a19bc1cc97f9562">&#9670;&#160;</a></span>static var DEFAULT_PORT</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">commonsNet.time.TimeUDPClient.static var DEFAULT_PORT : UInt16 = 37</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>默认时间端口，按照 RFC 868 规定将端口设置为 37。 </p>

</div>
</div>
<hr/>该类的文档由以下文件生成:<ul>
<li>src/time/<a class="el" href="time__udp__client_8cj.html">time_udp_client.cj</a></li>
</ul>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- HTML footer for doxygen 1.9.6-->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="namespacecommonsNet.html">commonsNet</a></li><li class="navelem"><a class="el" href="namespacecommonsNet_1_1time.html">time</a></li><li class="navelem"><a class="el" href="classcommonsNet_1_1time_1_1TimeUDPClient.html">TimeUDPClient</a></li>
    <li class="footer">制作者 <img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.6 </li>
  </ul>
</div>
</body>
</html>
